var gulp = require('gulp');
var postcss = require('gulp-postcss');

// postcss necessary plugin
var autoprefixer = require('autoprefixer');

// postcss plugin1
// var cssnext = require('cssnext');
// var precss = require('precss');

// postcss plugin2
// var color_rgba_fallback = require('postcss-color-rgba-fallback');//给rgba()颜色创建降级方案
// var opacity = require('postcss-opacity');//给opacity提供降级方案
// var pseudoelements = require('postcss-pseudoelements');//伪元素
// var vmin = require('postcss-vmin');
// var pixrem = require('pixrem');
// var will_change = require('postcss-will-change');//回退

// postcss plugin3
// var atImport = require('postcss-import');
// var mqpacker = require('css-mqpacker');
// var cssnano = require('cssnano');

// postcss plugin4
var precss = require('precss');

gulp.task('css', function() {
    var processors = [
        autoprefixer,//({browsers:'safari >= 9, ie >= 11'})设置Browserlsit
        // plugin2
        /*color_rgba_fallback,
        opacity,
        pseudoelements,
        vmin,
        pixrem,
        will_change*/
        // plugin1
        /*cssnext,
        precss*/
        // plugin3
        /*atImport,
        mqpacker,
        cssnano*/
        // plugin4
        precss
    ];
    return gulp.src('./src/style.css')
               .pipe(postcss(processors))
               .pipe(gulp.dest('./dest'));
})
